﻿<Pages:AudioBasePage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                     xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                     xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
                     xmlns:appbarutils="clr-namespace:AppBarUtils;assembly=AppBarUtils"
                     xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                     xmlns:Pages="clr-namespace:Samples.Radio.Pages"
                     xmlns:Converters="clr-namespace:Samples.Radio.Helpers.Converters"
                     xmlns:local="clr-namespace:Samples.Radio.Pages.Main"
                     xmlns:System="clr-namespace:System;assembly=mscorlib"
                     mc:Ignorable="d"
                     d:DesignWidth="480"
                     d:DesignHeight="800"
                     x:Class="Samples.Radio.Pages.Main.MainPage"
                     >
    <Pages:AudioBasePage.Resources>
    	<Converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
    	<Converters:ListItemNullConverter x:Key="ListItemNullConverter" />
    	<DataTemplate x:Key="ProgramsItemTemplate">
    		<StackPanel Margin="0,0,0,12">
    			<StackPanel Orientation="Horizontal"
    				Margin="0">
    				<TextBlock Text="{Binding StartTime}"
    					HorizontalAlignment="Left"
    					VerticalAlignment="Top"
    					Style="{StaticResource PhoneTextTitle2Style}"
    					Margin="0"
    					d:LayoutOverrides="VerticalAlignment"
    					Width="70"
    					FontFamily="{StaticResource PhoneFontFamilyNormal}"
    					Foreground="{StaticResource BrandColour1Brush}"/>
    				<StackPanel Orientation="Vertical"
    					Margin="0"
    					d:LayoutOverrides="Height"
    					VerticalAlignment="Top">
    					<TextBlock Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
    						d:LayoutOverrides="Width"
    						Style="{StaticResource PhoneTextTitle2Style}" />
    					<StackPanel Orientation="Horizontal"
    						Margin="12,-4,0,0">
    						<TextBlock Text="with "
    							d:LayoutOverrides="Width"
    							Style="{StaticResource PhoneTextNormalStyle}"
    							Margin="0" />
    						<TextBlock Text="{Binding Presenters, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
    							Style="{StaticResource PhoneTextNormalStyle}"
    							Margin="0"
    							d:LayoutOverrides="Width" />
    					</StackPanel>
    				</StackPanel>
    			</StackPanel>
    		</StackPanel>
    	</DataTemplate>
    	<DataTemplate x:Key="PodcastTracksItemTemplate">
    		<Grid Margin="0,0,0,24">
    			<StackPanel d:LayoutOverrides="Width, Height"
    				Margin="0,-7,0,0"
    				VerticalAlignment="Top">
    				<TextBlock Text="{Binding Title}"
    					Style="{StaticResource PhoneTextNormalStyle}"
    					FontSize="{StaticResource PhoneFontSizeMedium}" />
    				<TextBlock Text="{Binding PlaylistCount, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
    					Opacity="0.75"
    					Style="{StaticResource PhoneTextNormalStyle}"
    					FontSize="{StaticResource PhoneFontSizeMedium}" />
    			</StackPanel>
    		</Grid>
    	</DataTemplate>
    	<Style x:Key="SmallPlayToggleStyle" BasedOn="{StaticResource PhoneButtonBase}" TargetType="ToggleButton">
    		<Setter Property="Padding" Value="8"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="ToggleButton">
    					<Grid Background="Transparent">
    						<VisualStateManager.VisualStateGroups>
    							<VisualStateGroup x:Name="CommonStates">
    								<VisualState x:Name="Normal"/>
    								<VisualState x:Name="Disabled">
    									<Storyboard>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EnabledBackground">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Collapsed</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    								<VisualState x:Name="MouseOver"/>
    								<VisualState x:Name="Pressed">
    									<Storyboard>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="GD_Pressed">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Visible</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    							<VisualStateGroup x:Name="CheckStates">
    								<VisualState x:Name="Unchecked"/>
    								<VisualState x:Name="Checked">
    									<Storyboard>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="EnabledBackground">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="EnabledBackground">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="EnabledContent">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BO_Pause">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Visible</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BO_Play">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Collapsed</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BO_Play_Pressed">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Collapsed</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BO_Pause_Pressed">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<Visibility>Visible</Visibility>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    						</VisualStateManager.VisualStateGroups>
    						<Border x:Name="EnabledBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed">
    							<ContentControl x:Name="EnabledContent" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
    						</Border>
    						<Grid HorizontalAlignment="Center" Height="48" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" Width="48">
    							<Ellipse Stroke="{TemplateBinding Foreground}" StrokeThickness="{StaticResource PhoneStrokeThickness}"/>
    							<Border x:Name="BO_Play" BorderThickness="1" Background="{TemplateBinding Foreground}">
    								<Border.OpacityMask>
    									<ImageBrush Stretch="Fill" ImageSource="/WindowsPhoneAudioStreaming.SampleApplication;component/icons/appbar.control.play.png"/>
    								</Border.OpacityMask>
    							</Border>
    							<Border x:Name="BO_Pause" BorderThickness="1" Visibility="Collapsed" Background="{TemplateBinding Foreground}">
    								<Border.OpacityMask>
    									<ImageBrush Stretch="Fill" ImageSource="/WindowsPhoneAudioStreaming.SampleApplication;component/icons/appbar.control.pause.png"/>
    								</Border.OpacityMask>
    							</Border>
    							<Grid x:Name="GD_Pressed" Visibility="Collapsed">
    								<Ellipse x:Name="EL_Pressed" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{StaticResource PhoneStrokeThickness}" Fill="{TemplateBinding BorderBrush}"/>
    								<Border x:Name="BO_Play_Pressed" BorderThickness="1" Background="{TemplateBinding Background}">
    									<Border.OpacityMask>
    										<ImageBrush Stretch="Fill" ImageSource="/WindowsPhoneAudioStreaming.SampleApplication;component/icons/appbar.control.play.png"/>
    									</Border.OpacityMask>
    								</Border>
    								<Border x:Name="BO_Pause_Pressed" BorderThickness="1" Visibility="Collapsed" Background="{TemplateBinding Background}">
    									<Border.OpacityMask>
    										<ImageBrush Stretch="Fill" ImageSource="/WindowsPhoneAudioStreaming.SampleApplication;component/icons/appbar.control.pause.png"/>
    									</Border.OpacityMask>
    								</Border>
    							</Grid>
    						</Grid>
    					</Grid>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
    		<Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
    	</Style>
    </Pages:AudioBasePage.Resources>
	<Pages:AudioBasePage.DataContext>
		<Binding Path="Main" Source="{StaticResource Locator}"/>
	</Pages:AudioBasePage.DataContext>
	<Pages:AudioBasePage.Style>
		<StaticResource ResourceKey="TransitionPageStyle"/>
	</Pages:AudioBasePage.Style>
    <Pages:AudioBasePage.ApplicationBar>
        <shell:ApplicationBar Opacity="0.5"
                              Mode="Minimized">
            <shell:ApplicationBarIconButton x:Name="btnAllPrograms"
                                            IconUri="/icons/appbar.column.three.png"
                                            Text="podcasts" />
            <shell:ApplicationBarIconButton x:Name="btnSettings"
                                            IconUri="/icons/appbar.feature.settings.rest.png"
                                            Text="settings" />
        </shell:ApplicationBar>
    </Pages:AudioBasePage.ApplicationBar>
    <i:Interaction.Behaviors>
    	<appbarutils:AppBarItemNavigation Id="settings"
    		TargetPage="/SettingsPage" />
    	<appbarutils:AppBarItemNavigation Id="podcasts"
    		TargetPage="/ProgramListPage" />
    </i:Interaction.Behaviors>

	<Grid x:Name="LayoutRoot"
		d:DataContext="{d:DesignData /SampleData/MainPageSampleData/MainPageSampleData.xaml}"
		Background="Transparent">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="SG_ListenMode">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:0.4">
						<VisualTransition.GeneratedEasingFunction>
							<CircleEase EasingMode="EaseInOut"/>
						</VisualTransition.GeneratedEasingFunction>
					</VisualTransition>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="VS_ListenStream">
					<Storyboard>
						<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="BT_Close" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="VS_ListenPodcast">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="GD_PodcastPlaying">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<Visibility>Visible</Visibility>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="GD_LiveStream">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<Visibility>Collapsed</Visibility>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<DoubleAnimation Duration="0" To="72" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="BT_Close" d:IsOptimized="True"/>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="BT_Close">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>True</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BT_Close" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="BT_Close" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>

		<controls:Panorama Title="my application"
			TitleTemplate="{StaticResource PanoTitleTemplate}"
			Style="{StaticResource RadioTemplatePanoramaStyle}">
			<controls:Panorama.Background>
				<ImageBrush ImageSource="{StaticResource PanoramaBackground}"
					Stretch="UniformToFill" />
			</controls:Panorama.Background>

			<controls:PanoramaItem x:Name="PI_Listen" Header="listen"
				HeaderTemplate="{StaticResource EmptyPanoramaItemHeader}">
				<i:Interaction.Triggers>
					<ec:DataTrigger Binding="{Binding IsPlayingPodcasts}" Value="True">
						<ec:GoToStateAction x:Name="GT_Podcast" StateName="VS_ListenPodcast"/>
					</ec:DataTrigger>
					<ec:DataTrigger Binding="{Binding IsPlayingPodcasts}" Value="False">
						<ec:GoToStateAction x:Name="GT_LiveStream" StateName="VS_ListenStream"/>
					</ec:DataTrigger>
				</i:Interaction.Triggers>
				<ScrollViewer VerticalAlignment="Top">
					<StackPanel Margin="0,-26,0,24">
						<StackPanel Orientation="Horizontal" Margin="0,0,12,26">
							<TextBlock Text="listen"
								FontSize="72"
								FontFamily="Segoe WP SemiLight"
								Foreground="{StaticResource PhoneForegroundBrush}"
								d:LayoutOverrides="Width" Margin="10,0,12,0" />
							<ToggleButton x:Name="TB_PLay" Content="ToggleButton" Style="{StaticResource SmallPlayToggleStyle}" 
								Margin="0,0,0,2" VerticalAlignment="Bottom" Height="72" Width="72"
								IsChecked="{Binding IsPlayingStream, Mode=TwoWay}"
							/>
							<Button x:Name="BT_Close" 
								Style="{StaticResource CircleButtonStyle}" Background="{x:Null}" BorderBrush="{x:Null}" 
								Margin="0,0,0,2" VerticalAlignment="Bottom" Width="0" IsEnabled="False" Opacity="0" RenderTransformOrigin="0.5,0.5"
							>
								<Button.RenderTransform>
									<CompositeTransform ScaleX="0"/>
								</Button.RenderTransform>
								<ImageBrush ImageSource="/WindowsPhoneAudioStreaming.SampleApplication;component/icons/appbar.close.png"
									Stretch="None" />
							</Button>
						</StackPanel>
						<Grid x:Name="GD_LiveStream">
							<StackPanel x:Name="SP_NowPlaying"
								Margin="0" d:LayoutOverrides="Width, Height">
								<TextBlock TextWrapping="Wrap"
									Text="{StaticResource LiveStream}"
									Style="{StaticResource PhoneTextTitle2Style}"
									Foreground="{StaticResource PhoneForegroundBrush}" Margin="12,-12,12,8" />
								<StackPanel x:Name="SP_Program"
									Margin="12,0"
									Visibility="{Binding HasCurrentProgram, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour1Brush}">
									<Button DataContext="{Binding CurrentProgram}"
										Style="{StaticResource ProgramInfoButtonStyle}"
										VerticalAlignment="Top" Background="{x:Null}" 
										ContentTemplate="{StaticResource ProgramInfoDataTemplate}"
										Content="{Binding}"
									>
										<i:Interaction.Triggers>
											<i:EventTrigger EventName="Click">
												<ec:NavigateToPageAction TargetPage="/Pages/Program/ProgramPage.xaml"/>
											</i:EventTrigger>
										</i:Interaction.Triggers>
									</Button>
								</StackPanel>
								<Grid x:Name="GD_Stream" Margin="12,0,12,12" Height="{Binding Height, ElementName=toggleButton}" Background="{StaticResource BrandColour1Brush}">
									<Rectangle Fill="{StaticResource PhoneBackgroundBrush}" Stroke="Black" Opacity="0.2" Visibility="Collapsed"/>
								</Grid>
								<StackPanel x:Name="SP_CurrentTrack"
									Orientation="Vertical"
									Margin="0" d:LayoutOverrides="Width" d:DataContext="{Binding Source={StaticResource MainPageSampleData}}">
									<TextBlock TextWrapping="Wrap"
										Text="{Binding Source={StaticResource CurrentTrack}, ConverterParameter=upper, Converter={StaticResource CaseConverter} }"
										Style="{StaticResource PhoneTextTitle2Style}"
										Margin="12,0,0,12"
										Foreground="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Left" />
									<ListBoxItem Content="{Binding CurrentStream}" ContentTemplate="{StaticResource TrackItemTemplate}" Margin="{StaticResource PhoneHorizontalMargin}"/>
								</StackPanel>
								<StackPanel x:Name="SP_PreviousTracks_Copy"
									Orientation="Vertical"
									Margin="0,0,0,24" d:LayoutOverrides="Width">
									<StackPanel x:Name="pnlPreviousTracks1"
										Orientation="Horizontal">
										<TextBlock TextWrapping="Wrap"
											Text="PREVIOUS TRACKS"
											Style="{StaticResource PhoneTextTitle2Style}"
											Margin="12,0,0,12"
											Foreground="White" >
											<i:Interaction.Triggers>
												<i:EventTrigger EventName="Tap">
													<ec:CallMethodAction TargetObject="{Binding}"
														MethodName="RefreshPlayList" />
												</i:EventTrigger>
											</i:Interaction.Triggers>
										</TextBlock>
									</StackPanel>
									<ListBox ItemTemplate="{StaticResource TrackItemTemplate}"
										ItemsSource="{Binding RecentTracks}"
										Margin="12,0,0,0"
										ScrollViewer.VerticalScrollBarVisibility="Disabled" />
								</StackPanel>
							</StackPanel>
						</Grid>
						<Grid x:Name="GD_PodcastPlaying" Visibility="Collapsed">
							<StackPanel x:Name="SP_NowPlaying1"
								Margin="0" d:LayoutOverrides="Width, Height">
								<TextBlock TextWrapping="Wrap"
									Style="{StaticResource PhoneTextTitle2Style}"
									Foreground="{StaticResource PhoneForegroundBrush}" Margin="12,-12,12,0" Text="{StaticResource Podcast}" />
								<ListBoxItem x:Name="LI_Podcast" Content="ListBoxItem" Margin="{StaticResource PhoneHorizontalMargin}" ContentTemplate="{StaticResource FeaturedPodcastDataTemplate}"/>
								<TextBlock TextWrapping="Wrap"
									Style="{StaticResource PhoneTextTitle2Style}"
									Foreground="{StaticResource PhoneForegroundBrush}" Margin="12,12,12,0" Text="{StaticResource Program}" />
								<StackPanel x:Name="SP_Program1"
									Margin="12,0"
									Visibility="{Binding HasCurrentProgram, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour1Brush}">
                                    <Button DataContext="{Binding CurrentProgram}"
										Style="{StaticResource ProgramInfoButtonStyle}"
										VerticalAlignment="Top" Background="{x:Null}" 
										ContentTemplate="{StaticResource ProgramInfoDataTemplate}"
										Content="{Binding}"
									>
										<i:Interaction.Triggers>
											<i:EventTrigger EventName="Click">
												<ec:NavigateToPageAction TargetPage="/Pages/Program/ProgramPage.xaml"/>
											</i:EventTrigger>
										</i:Interaction.Triggers>
									</Button>
								</StackPanel>
							</StackPanel>
						</Grid>
					</StackPanel>
				</ScrollViewer>
				<!--Double line list with text wrapping-->
			</controls:PanoramaItem>
			<controls:PanoramaItem x:Name="PI_Program" Header="program"
				HeaderTemplate="{StaticResource EmptyPanoramaItemHeader}">
				<ScrollViewer Margin="0,-26,0,0">
					<StackPanel Orientation="Vertical">
						<TextBlock Text="program"
							FontSize="72"
							Margin="5,0,0,26"
							FontFamily="Segoe WP SemiLight"
							Foreground="{StaticResource PhoneForegroundBrush}" />
						<StackPanel Margin="12,0,0,12"
							Orientation="Horizontal"
							d:LayoutOverrides="Width"
							Background="{StaticResource BrandColour1Brush}">
							<TextBlock TextWrapping="Wrap"
								Text="{Binding Today, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
								Style="{StaticResource PhoneTextTitle2Style}"
								Foreground="White"
								Margin="12,0,12,2" />
							<!--DataContext="{Binding Source={StaticResource SampleProgramInfo}}"-->
						</StackPanel>
						<ListBox ItemTemplate="{StaticResource ProgramsItemTemplate}"
							ItemsSource="{Binding Programs}"
							BorderThickness="12,0,0,0"
							Margin="0,0,0,36"
							ScrollViewer.VerticalScrollBarVisibility="Disabled" />
					</StackPanel>
				</ScrollViewer>
			</controls:PanoramaItem>
			<controls:PanoramaItem x:Name="PI_Podcasts" Header="{StaticResource podcasts}">
				<Grid>
					
					<StackPanel Margin="12,0,0,0" Orientation="Vertical" d:LayoutOverrides="Height">
						<ListBoxItem x:Name="LI_Playlist" Margin="0"
							toolkit:TiltEffect.IsTiltEnabled="True"
							HorizontalContentAlignment="Left"
							Padding="0,3,10,5" d:DataContext="{Binding Source={StaticResource MainPageSampleData}}" BorderThickness="0,0,0,12">
							<i:Interaction.Triggers>
								<i:EventTrigger EventName="Tap">
									<ec:NavigateToPageAction TargetPage="/Pages/Playlist/PlaylistPage.xaml" />
								</i:EventTrigger>
							</i:Interaction.Triggers>
							<StackPanel x:Name="SP_Playlist1" Orientation="Vertical" Margin="0">
								<TextBlock 
									Text="{Binding ConverterParameter=upper, 
										Converter={StaticResource CaseConverter}, Source={StaticResource MyPlaylist}}"
									Style="{StaticResource PhoneTextLargeStyle}"
									HorizontalAlignment="Left"
									Margin="0,-14,0,0" 
								/>
								<StackPanel x:Name="SP_ItemCount" HorizontalAlignment="Left" Orientation="Horizontal" Visibility="{Binding Playlist.isEmpty, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
									<TextBlock
										Style="{StaticResource PhoneTextNormalStyle}"
										HorizontalAlignment="Left"
										Margin="0" Text="{Binding Playlist.PlaylistCount}" Foreground="{StaticResource BrandColour1Brush}" />
									<TextBlock
										Style="{StaticResource PhoneTextNormalStyle}"
										HorizontalAlignment="Left"
										Margin="0" Text="{StaticResource Items}" Foreground="{StaticResource BrandColour1Brush}" />
								</StackPanel>
								<TextBlock
									Style="{StaticResource PhoneTextNormalStyle}"
									HorizontalAlignment="Left"
									Margin="0" Text="{StaticResource Empty}" 
									Visibility="{Binding Playlist.isEmpty, Converter={StaticResource BooleanToVisibilityConverter}}" 
								/>
							</StackPanel>
						</ListBoxItem>
						
						<TextBlock
							Style="{StaticResource PhoneTextLargeStyle}"
							HorizontalAlignment="Left"
							Margin="0" d:LayoutOverrides="HorizontalAlignment" Text="{StaticResource Featured}" 
						/>
					
						<ListBox ItemsSource="{Binding FeaturedPodcasts}" 
							toolkit:TiltEffect.IsTiltEnabled="True"
							HorizontalContentAlignment="Stretch" Height="506"
						>
							<ListBox.Resources>
								<DataTemplate x:Key="FeaturedItemTemplate">
                				
									<local:PodcastTemplateSelector Content="{Binding}" Margin="0" 
										FirstItemTemplate="{StaticResource FeaturedPodcastDataTemplate}"
										Template0="{StaticResource PodcastTemplate0}"
									>
										<i:Interaction.Triggers>
                                            <i:EventTrigger EventName="MouseLeftButtonDown">
                                                <ec:NavigateToPageAction>
                                                    <ec:NavigateToPageAction.TargetPage>
                                                        <Binding Path="ProgramName" StringFormat="/PodcastPage/{0}"/>
                                                    </ec:NavigateToPageAction.TargetPage>
                                                </ec:NavigateToPageAction> 
                                            </i:EventTrigger>
										</i:Interaction.Triggers>
			

							
										<local:PodcastTemplateSelector.Template1>
											<DataTemplate >
												<Grid
													Width="{StaticResource Podcast half width}"
													Height="{StaticResource Podcast Half Height}" 
													Background="{StaticResource BrandColour2Brush}" 										
									>
													<Image Source="{Binding ProgramImage}"
														HorizontalAlignment="Left" 
										/>
													<ContentControl Content="{Binding}"
														HorizontalContentAlignment="Stretch" 
														VerticalContentAlignment="Stretch" 
														Background="{StaticResource BrandColour2Brush}" 
														Style="{StaticResource HalfPodcastContentControlStyle}" 
														Margin="0" 
										/>
												</Grid>
											</DataTemplate>
										</local:PodcastTemplateSelector.Template1>

										<local:PodcastTemplateSelector.Template2>
											<DataTemplate >
												<Grid
													Width="{StaticResource Podcast half width}"
													Height="{StaticResource Podcast Half Height}" 
													Background="{StaticResource BrandColour1Brush}" 										
									>
													<Grid Margin="0" d:LayoutOverrides="Width, Height">
														<Image Source="{Binding ProgramImage}"
															HorizontalAlignment="Left" 

											/>
														<ContentControl Content="{Binding}"
															HorizontalContentAlignment="Stretch" 
															VerticalContentAlignment="Stretch" 
															Background="{StaticResource BrandColour1Brush}" 
															Style="{StaticResource HalfPodcastContentControlStyle}" 
															Margin="0" 
											/>
													</Grid>
												</Grid>
											</DataTemplate>
										</local:PodcastTemplateSelector.Template2>
				
										<local:PodcastTemplateSelector.Template3>


											<DataTemplate >
												<Grid
													Width="{StaticResource Podcast half width}"
													Height="{StaticResource Podcast Half Height}" 
													Background="{StaticResource BrandColour2Brush}" 										
									>
													<Image Source="{Binding ProgramImage}"
														HorizontalAlignment="Left" 
										/>
													<ContentControl Content="{Binding}"
														HorizontalContentAlignment="Stretch" 
														VerticalContentAlignment="Stretch" 
														Background="{StaticResource BrandColour1Brush}" 
														Style="{StaticResource HalfPodcastContentControlStyle}" 
														Margin="0" 
										/>
												</Grid>
											</DataTemplate>
										</local:PodcastTemplateSelector.Template3>						
								
									</local:PodcastTemplateSelector>
                				
								</DataTemplate>
								<ItemsPanelTemplate x:Key="FeaturedItemsPanel">
									<toolkit:WrapPanel/>
								</ItemsPanelTemplate>
							</ListBox.Resources>
							<ListBox.ItemContainerStyle>
								<StaticResource ResourceKey="PodcastListBoxItemContainerStyle"/>
							</ListBox.ItemContainerStyle>
							<ListBox.ItemsPanel>
								<StaticResource ResourceKey="FeaturedItemsPanel"/>
							</ListBox.ItemsPanel>
							<ListBox.ItemTemplate>
								<StaticResource ResourceKey="FeaturedItemTemplate"/>
							</ListBox.ItemTemplate>
						</ListBox>
					
					</StackPanel>
					
					<ScrollViewer Visibility="Collapsed">
						<StackPanel Margin="0">
							<toolkit:WrapPanel Margin="12,0,-12,0">
								<ListBoxItem  Margin="0,0,12,18"
									Width="408"
									Visibility="{Binding HasFeaturedProgram, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour1Brush}"
									toolkit:TiltEffect.IsTiltEnabled="True"
									HorizontalContentAlignment="Stretch">
									<Grid DataContext="{Binding FeaturedPodcasts, ConverterParameter=0, Converter={StaticResource ListItemNullConverter}}"
										Tap="FeaturedProgramTap">
										<Image Source="{Binding ProgramImage}"
											Height="170"
											HorizontalAlignment="Left"
											VerticalAlignment="Top" />
										<Grid VerticalAlignment="Bottom">
											<Border Opacity="0.5"
												Margin="0,2,0,0"
												Background="Black" />
											<StackPanel Margin="12,0"
												Orientation="Vertical"
												d:LayoutOverrides="Height">
												<TextBlock TextWrapping="Wrap"
													Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
													Style="{StaticResource PhoneTextExtraLargeStyle}"
													Margin="0,0,0,-4"
													HorizontalAlignment="Right"
													Foreground="#DEFFFFFF" />
												<TextBlock TextWrapping="Wrap"
													Text="{Binding Description}"
													Style="{StaticResource PhoneTextTitle3Style}"
													Margin="0,0,0,6"
													HorizontalAlignment="Right"
													TextAlignment="Right"
													Foreground="#DEFFFFFF" />
											</StackPanel>
										</Grid>
									</Grid>
								</ListBoxItem>
								<ListBoxItem  Margin="0,0,12,18"
									Width="198"
									toolkit:TiltEffect.IsTiltEnabled="True"
									HorizontalContentAlignment="Stretch"
									Visibility="{Binding HasSubFeaturedProgram1, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour2Brush}">
									<Grid DataContext="{Binding FeaturedPodcasts, ConverterParameter=1, Converter={StaticResource ListItemNullConverter}}"
										Tap="FeaturedProgramTap">
										<Image Source="{Binding ProgramImage}"
											Height="110"
											HorizontalAlignment="Left"
											VerticalAlignment="Top" />
										<Grid VerticalAlignment="Bottom">
											<Border Opacity="0.5"
												Margin="0"
												Background="{StaticResource BrandColour1Brush}"/>
											<TextBlock TextWrapping="Wrap"
												Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
												d:LayoutOverrides="Height"
												Style="{StaticResource PhoneTextTitle3Style}"
												TextAlignment="Right"
												HorizontalAlignment="Right"
												Foreground="#DEFFFFFF" />
										</Grid>
										<TextBlock HorizontalAlignment="Right"
											TextWrapping="Wrap"
											Text="{Binding PublishedDate}"
											VerticalAlignment="Top"
											Style="{StaticResource PhoneTextNormalStyle}"
											Foreground="#DEFFFFFF" />
									</Grid>

								</ListBoxItem>
								<ListBoxItem  Margin="0,0,12,18"
									Width="198"
									toolkit:TiltEffect.IsTiltEnabled="True"
									HorizontalContentAlignment="Stretch"
									Visibility="{Binding HasSubFeaturedProgram2, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour1Brush}">
									<Grid DataContext="{Binding FeaturedPodcasts, ConverterParameter=2, Converter={StaticResource ListItemNullConverter}}"
										Tap="FeaturedProgramTap">

										<Image Source="{Binding ProgramImage}"
											Height="110"
											HorizontalAlignment="Left"
											VerticalAlignment="Top" />
										<Grid VerticalAlignment="Bottom">
											<Border Opacity="0.5"
												Margin="0,2,0,0"
												Background="{StaticResource BrandColour1Brush}"/>
											<TextBlock TextWrapping="Wrap"
												Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
												d:LayoutOverrides="Height"
												Style="{StaticResource PhoneTextTitle3Style}"
												HorizontalAlignment="Right"
												Foreground="#DEFFFFFF" />
										</Grid>
										<TextBlock HorizontalAlignment="Right"
											TextWrapping="Wrap"
											Text="{Binding PublishedDate}"
											VerticalAlignment="Top"
											Style="{StaticResource PhoneTextNormalStyle}"
											Foreground="#DEFFFFFF" />
									</Grid>

								</ListBoxItem>
								<ListBoxItem  Margin="0,0,12,18"
									Width="198"
									toolkit:TiltEffect.IsTiltEnabled="True"
									HorizontalContentAlignment="Stretch"
									Visibility="{Binding HasSubFeaturedProgram3, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour1Brush}">
									<Grid DataContext="{Binding FeaturedPodcasts, ConverterParameter=3, Converter={StaticResource ListItemNullConverter}}"
										Tap="FeaturedProgramTap">

										<Image Source="{Binding ProgramImage}"
											Height="110"
											HorizontalAlignment="Left"
											VerticalAlignment="Top" />
										<Grid VerticalAlignment="Bottom">
											<Border Opacity="0.5"
												Margin="0"
												Background="{StaticResource BrandColour2Brush}"/>
											<TextBlock TextWrapping="Wrap"
												Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
												d:LayoutOverrides="Height"
												Style="{StaticResource PhoneTextTitle3Style}"
												HorizontalAlignment="Right"
												TextAlignment="Right"
												Foreground="#DEFFFFFF" />
										</Grid>
										<TextBlock HorizontalAlignment="Right"
											TextWrapping="Wrap"
											Text="{Binding PublishedDate}"
											VerticalAlignment="Top"
											Style="{StaticResource PhoneTextNormalStyle}"
											Foreground="#DEFFFFFF" />
									</Grid>

								</ListBoxItem>
								<ListBoxItem Margin="0,0,12,18"
									Width="198"
									toolkit:TiltEffect.IsTiltEnabled="True"
									HorizontalContentAlignment="Stretch"
									Visibility="{Binding HasSubFeaturedProgram4, Converter={StaticResource BooleanToVisibilityConverter}}"
									Background="{StaticResource BrandColour2Brush}">
									<Grid DataContext="{Binding FeaturedPodcasts, ConverterParameter=4, Converter={StaticResource ListItemNullConverter}}"
										Tap="FeaturedProgramTap">

										<Image Source="{Binding ProgramImage}"
											Height="110"
											HorizontalAlignment="Left"
											VerticalAlignment="Top" />
										<Grid VerticalAlignment="Bottom">
											<Border Opacity="0.5"
												Margin="0,2,0,0"
												Background="Black" />
											<TextBlock TextWrapping="Wrap"
												Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
												d:LayoutOverrides="Height"
												Style="{StaticResource PhoneTextTitle3Style}"
												HorizontalAlignment="Right"
												TextAlignment="Right"
												Foreground="#DEFFFFFF" />
										</Grid>
										<TextBlock HorizontalAlignment="Right"
											TextWrapping="Wrap"
											Text="{Binding PublishedDate}"
											VerticalAlignment="Top"
											Style="{StaticResource PhoneTextNormalStyle}"
											Foreground="#DEFFFFFF" />
									</Grid>

								</ListBoxItem>
							</toolkit:WrapPanel>
						</StackPanel>
					</ScrollViewer>
				</Grid>
			</controls:PanoramaItem>
			<controls:PanoramaItem x:Name="PI_Playlists" Header="my playlist"
				HeaderTemplate="{StaticResource EmptyPanoramaItemHeader}" Visibility="Collapsed">
				<!-- DELETE ME-->
				<ScrollViewer VerticalAlignment="Top">
					<StackPanel Margin="0,-26,0,24">
						<TextBlock Text="my playlist"
							FontSize="72"
							Margin="6,0,0,26"
							FontFamily="Segoe WP SemiLight"
							Foreground="{StaticResource PhoneForegroundBrush}"
							d:LayoutOverrides="Width" />
						<StackPanel x:Name="SP_NowPlayingPlaylist"
							Margin="12,0,0,0"
							Visibility="{Binding HasPodcasts, Converter={StaticResource BooleanToVisibilityConverter}}">
							<StackPanel x:Name="SP_ProgramPlaylist"
								Width="408"
								Margin="0,0,0,12"
								Background="{StaticResource BrandColour1Brush}">
								<StackPanel Orientation="Horizontal"
									d:LayoutOverrides="Width"
									Margin="0,-4,0,4">
									<TextBlock TextWrapping="Wrap"
										Text="podcasts"
										Style="{StaticResource PhoneTextNormalStyle}"
										Margin="12,0,6,0" />
								</StackPanel>
							</StackPanel>
							<TextBlock TextWrapping="Wrap"
								Text="PODCAST SELECTION"
								Style="{StaticResource PhoneTextTitle2Style}"
								Margin="12,12,12,0"
								Foreground="White" />
							<Grid Margin="0,12,0,0">
								<ToggleButton Content="{Binding CurrentTrack.Title}"
									Style="{StaticResource PlayButtonTemplate}"
									IsChecked="{Binding IsPlayingPodcasts, Mode=TwoWay}"
									FontSize="{StaticResource PhoneFontSizeLarge}"
									FontFamily="{StaticResource PhoneFontFamilySemiLight}"
									Tag="{Binding CurrentTrack.Description, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
									d:LayoutOverrides="Width"
									VerticalAlignment="Top"
									Margin="0" Padding="12">
									<i:Interaction.Triggers>
										<i:EventTrigger EventName="Checked">
											<ec:CallMethodAction TargetObject="{Binding}"
												MethodName="PlayPodcasts" />
										</i:EventTrigger>
										<i:EventTrigger EventName="Unchecked">
											<ec:CallMethodAction TargetObject="{Binding}"
												MethodName="Pause" />
										</i:EventTrigger>
									</i:Interaction.Triggers>
									<ToggleButton.Background>
										<SolidColorBrush Color="{StaticResource PhoneBackgroundColor}"
											Opacity="0.33" />
									</ToggleButton.Background>
								</ToggleButton>
							</Grid>
							<Slider SmallChange="1"
								Maximum="{Binding MaximumPlayerDurationSeconds}"
								Value="{Binding PlayerCurrentSecondsElapsed}"
								d:LayoutOverrides="Width"
								Margin="0"
								VerticalAlignment="Top"
								Foreground="{StaticResource BrandColour1Brush}" LargeChange="5">
								<Slider.Background>
									<SolidColorBrush Color="{StaticResource PhoneBackgroundColor}" />
								</Slider.Background>
							</Slider>
						</StackPanel>
						<StackPanel x:Name="SP_Playlist"
							Orientation="Vertical"
							Margin="12,0,0,24">
							<StackPanel x:Name="pnlPlaylistTracks"
								Orientation="Horizontal">
								<TextBlock TextWrapping="Wrap"
									Text="PLAYLIST"
									Style="{StaticResource PhoneTextTitle2Style}"
									Margin="12,0,0,12"
									Foreground="White" />
							</StackPanel>
							<ListBox x:Name="lbMyPlaylist"
								ItemTemplate="{StaticResource PodcastTracksItemTemplate}"
								ItemsSource="{Binding OLDPlaylist}"
								Margin="12,0,0,0"
								ScrollViewer.VerticalScrollBarVisibility="Disabled" />
							<TextBlock x:Name="lblPlaylistHelp"
								TextWrapping="Wrap"
								Text="to add items, go to programs and add podcasts to the playlist"
								Style="{StaticResource PhoneTextNormalStyle}"
								Margin="12,0,6,0"
								Foreground="{StaticResource BrandColour2Brush}"/>
						</StackPanel>
					</StackPanel>
				</ScrollViewer>
				<!--Double line list with text wrapping-->
			</controls:PanoramaItem>
		</controls:Panorama>
	</Grid>
</Pages:AudioBasePage>
